import {QueryService  } from "@supermap/iclient-mapboxgl/services/QueryService";
export const queryGeometrysService = (json: Array<SuperMap.REST.FilterParameter>&{url:string,geometry:SuperMap.Geometry}) => {
    // var  queryParams=[];
    var queryBySQLParams, queryBySQLService;
    // for(var i=0;i<json.length;i++){
    //    var queryParam = new SuperMap.REST.FilterParameter(json[i]);
    //    queryParams.push(queryParam);
    // }  
    (new QueryService()).queryByGeometry()
    SuperMap.REST.LinkItem
    json[0].attributeFilter
    var queryParams = json.map(r => new SuperMap.REST.FilterParameter(r));
    queryBySQLParams = new SuperMap.REST.QueryByGeometryParameters({
        queryParams: queryParams,
        geometry: json.geometry,
        queryOption: "ATTRIBUTEANDGEOMETRY" as SuperMap.REST.QueryOption.ATTRIBUTEANDGEOMETRY,
        isNearest: json.isNearest == undefined ? false : json.isNearest,
        spatialQueryMode: json.queryMode,
        startRecord: json.startRecord = json.startRecord == undefined ? 0 : json.startRecord,
        expectCount: json.expectCount = json.expectCount == undefined ? serive_sys.contants.expectCount : json.expectCount
    });
    queryBySQLService = new SuperMap.REST.QueryByGeometryService(json.url, {
        eventListeners: {
            "processCompleted": function (queryEventArgs) {
                if (typeof (json.callback) === "function") {
                    json.callback(queryEventArgs);
                }
            }, "processFailed": this._functionFailed
        }
    });
    queryBySQLService.processAsync(queryBySQLParams);
}